Guest User

Untitled

a guest
Oct 20th, 2017
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. export default angular.module('ppollitApp.login', [])
  2. .controller('LoginController', function($scope, $cookies) {
  3. $scope.myCookieVal = $cookies.get('cookie');
  4. $scope.setCookie = function(val) {
  5. $cookies.put('cookie', val);
  6. };
  7. })
  8. .name;
  9.  
  10. 'use strict';
  11.  
  12. export default class LoginController {
  13. user = {
  14. name: '',
  15. email: '',
  16. password: '',
  17. };
  18. errors = {
  19. login: undefined
  20. };
  21. submitted = false;
  22.  
  23.  
  24. /*@ngInject*/
  25. constructor(Auth, $state) {
  26. this.Auth = Auth;
  27. this.$state = $state;
  28. }
  29.  
  30. login(form) {
  31. this.submitted = true;
  32.  
  33. if(form.$valid) {
  34. this.Auth.login({
  35. email: this.user.email,
  36. password: this.user.password,
  37. cookie: this.user.cookie
  38. })
  39. .then(() => {
  40. // Logged in, redirect to home
  41. this.$state.go('main');
  42. })
  43. .catch(err => {
  44. this.errors.login = err.message;
  45. });
  46. }
  47. }
  48. }
  49.  
  50. <form role="form" class="bottom-75" name="form" ng-submit="vm.login(form)">
  51. <div class="table-form">
  52. <div class="form-groups">
  53. <div class="form-group">
  54. <input type="text" class="form-control input-lg" id="" placeholder="E-mail" name="email" ng-model="vm.user.email" required>
  55. </div>
  56. <div class="form-group">
  57. <input type="password" class="form-control input-lg" id="" placeholder="Mot de passe" name="mot de passe" ng-model="vm.user.password" required>
  58. </div>
  59.  
  60.  
  61. </div>
  62. <div class="button-container">
  63. <button type="submit" class="btn btn-default login"><img src="assets/images/arrow.png" alt=""></button>
  64. </div>
  65.  
  66.  
  67. </div>
  68. <div class="remember">
  69. <label class="checkbox1" for="Option">
  70. <input id="Option" type="checkbox" class="">
  71. <span></span>
  72. </label>
  73. Se rappeler de moi
  74. <span class="pass"> Mot de passe oublié?</span>
  75. <a class="btn btn-primary btn-lg btn-white" ui-sref="signup">Créer un nouveau compte</a>
  76. </div>
  77.  
  78.  
  79. <oauth-buttons classes="btn-block"></oauth-buttons>
  80. <!--a class="btn btn-lg btn-social-icon btn-twitter btn-white">
  81. <span class="fa fa-twitter"></span>
  82. </!--a>
  83.  
  84. <a class="btn btn-lg btn-social-icon btn-google btn-white">
  85. <span class="fa fa-google"></span>
  86. </a>
  87.  
  88. <a class="btn btn-lg btn-social-icon btn-facebook btn-white" ng-click="OauthButtons.loginOauth('facebook')">
  89. <span class="fa fa-facebook"></span>
  90. </a-->
  91. </div>
  92. </form>
Add Comment
Please, Sign In to add comment