Advertisement
Guest User

Untitled

a guest
Jan 13th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. function cognito_login(username, password) {
  2.  
  3. var authenticationData = {
  4. Username : username,
  5. Password : password
  6. };
  7. var authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
  8. var userData = {
  9. Username : username,
  10. Pool : AWSC_userPool
  11. };
  12.  
  13. var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
  14. cognitoUser.authenticateUser(authenticationDetails, {
  15. onSuccess: function (result) {
  16. return true;
  17. },
  18.  
  19. onFailure: function(err) {
  20. console.log(err);
  21. return false;
  22. }
  23. });
  24. }
  25.  
  26. from flask_wtf import FlaskForm
  27. from wtforms.fields import TextField, BooleanField, PasswordField
  28. from wtforms.validators import DataRequired
  29.  
  30. class LoginForm(FlaskForm):
  31. username = TextField('username', validators=[DataRequired()])
  32. password = PasswordField('password', validators=[DataRequired()])
  33.  
  34. def validate(self):
  35. if not FlaskForm.validate(self):
  36. return False
  37.  
  38. ... javascript here ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement