我需要验证密码输入表单字段的强度.
要求是:
- 至少一个小写字符
- 至少一个大写字符
- 至少一个数字
(无论顺序)
到目前为止我搜索和尝试的内容如下所示,结果不一致.它似乎验证了正则表达式验证的顺序.
我需要的是检查是否存在至少一个char"类型".
谢谢
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'signup',
templateUrl: './signup.component.html',
styleUrls: ['./signup.component.scss']
})
export class SignupComponent {
form: FormGroup;
constructor() {
this.init();
}
init() {
this.form = this.fb.group({
name: ['', [Validators.required]],
email: ['', [Validators.required, Validators.email],
password: ['', [
Validators.required,
Validators.pattern('((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,30})')
]]
});
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用打字稿的云功能.
成功安装后,添加了触发器并进行了测试部署.
index.ts
import * as functions from 'firebase-functions';
export const createAccount = functions.auth.user().onCreate(event => {
const user = event.data;
console.log('user displayname', user.displayName);
return;
});
Run Code Online (Sandbox Code Playgroud)
命令
firebase deploy --only functions
=== Deploying to 'project'...
i deploying functions
i functions: running predeploy script.
> functions@ build D:\vmbox\project\firebase\functions
> tslint -p tslint.json && ./node_modules/.bin/tsc
Run Code Online (Sandbox Code Playgroud)
错误
'.' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
环境
firebase cli v3.16.0
node v6.11.2
npm v4.2.0
操作系统:Windows 10
终端:powershell
/// …
我正在使用带有 angularFire 服务 $firebaseAuth 和方法 $signInWithPopup 的 Firebase 身份验证实现 Google 身份验证登录。
如果它被解决或拒绝,该方法将返回一个承诺,到目前为止一切都清楚。
我试图改进的是当用户在没有登录的
情况下关闭弹出窗口时。在这种情况下,promise 返回的代码错误是:auth/popup-closed-by-user。
问题是这可能需要 30 秒才能发生:
app.controller("SampleCtrl", function($firebaseAuth) {
$firebaseAuth().$signInWithPopup("google").then(function(result) {
console.log("Signed in as:", result.user.uid);
}).catch(function(error) {
console.error("Authentication failed:", error);
});
});
Run Code Online (Sandbox Code Playgroud)
有没有办法在弹出窗口关闭时立即捕捉?
编辑:我正在使用angularFire 2.0.1和Firebase 3.0.3