Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default angular.module('ppollitApp.login', [])
- .controller('LoginController', function($scope, $cookies) {
- $scope.myCookieVal = $cookies.get('cookie');
- $scope.setCookie = function(val) {
- $cookies.put('cookie', val);
- };
- })
- .name;
- 'use strict';
- export default class LoginController {
- user = {
- name: '',
- email: '',
- password: '',
- };
- errors = {
- login: undefined
- };
- submitted = false;
- /*@ngInject*/
- constructor(Auth, $state) {
- this.Auth = Auth;
- this.$state = $state;
- }
- login(form) {
- this.submitted = true;
- if(form.$valid) {
- this.Auth.login({
- email: this.user.email,
- password: this.user.password,
- cookie: this.user.cookie
- })
- .then(() => {
- // Logged in, redirect to home
- this.$state.go('main');
- })
- .catch(err => {
- this.errors.login = err.message;
- });
- }
- }
- }
- <form role="form" class="bottom-75" name="form" ng-submit="vm.login(form)">
- <div class="table-form">
- <div class="form-groups">
- <div class="form-group">
- <input type="text" class="form-control input-lg" id="" placeholder="E-mail" name="email" ng-model="vm.user.email" required>
- </div>
- <div class="form-group">
- <input type="password" class="form-control input-lg" id="" placeholder="Mot de passe" name="mot de passe" ng-model="vm.user.password" required>
- </div>
- </div>
- <div class="button-container">
- <button type="submit" class="btn btn-default login"><img src="assets/images/arrow.png" alt=""></button>
- </div>
- </div>
- <div class="remember">
- <label class="checkbox1" for="Option">
- <input id="Option" type="checkbox" class="">
- <span></span>
- </label>
- Se rappeler de moi
- <span class="pass"> Mot de passe oublié?</span>
- <a class="btn btn-primary btn-lg btn-white" ui-sref="signup">Créer un nouveau compte</a>
- </div>
- <oauth-buttons classes="btn-block"></oauth-buttons>
- <!--a class="btn btn-lg btn-social-icon btn-twitter btn-white">
- <span class="fa fa-twitter"></span>
- </!--a>
- <a class="btn btn-lg btn-social-icon btn-google btn-white">
- <span class="fa fa-google"></span>
- </a>
- <a class="btn btn-lg btn-social-icon btn-facebook btn-white" ng-click="OauthButtons.loginOauth('facebook')">
- <span class="fa fa-facebook"></span>
- </a-->
- </div>
- </form>
Add Comment
Please, Sign In to add comment