Skip to content

Commit 6d84728

Browse files
committed
dev suite
sauvegarde
1 parent 26a54c4 commit 6d84728

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

Diff for: Zenergy/Zenergy/Scripts/Controllers/registerPageController.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
zenergyApp.controller("registerPageController", ["$scope", "$http", "$httpParamSerializerJQLike", "tokenService", "$window", function ($scope, $http, $httpParamSerializerJQLike, tokenService, $window) {
2-
3-
$scope.user = { mail: '', password: '', passwordBis: '', firstName :'', lastName:'', adr1:'', adr2:'', pc:'', town:'', phone:''};
1+
zenergyApp.controller("registerPageController",["$scope","$http", function($scope, $http){
2+
3+
$scope.user = {mail: '', password: '', passwordBis: '', lastName:'', firstName:'', adr1:'', adr2:'', pc:'', town:'', phone:''};
44
$scope.hasError = false;
5-
$scope.signIn = function () {
5+
$scope.register = function () {
66
var response = $http({
77
url: 'api/Account/register',
88
method: 'POST',
9-
data: $httpParamSerializerJQLike({ grant_type: 'password', username: $scope.user.mail, password: $scope.user.password }),
10-
//data: $httpParamSerializerJQLike({ grant_type: 'password', username: $scope.user.mail, password: CryptoJS.MD5($scope.user.password).toString() }),
9+
data: $httpParamSerializerJQLike({ userId: 1, password: CryptoJS.MD5($scope.user.password).toString(), lastName: $scope.user.lastName, firstName: $scope.user.firstName, adr1: $scope.user.adr1, adr2: $scope.user.adr2, pc: $scope.user.pc, town: $scope.user.town, mail: $scope.user.mail, phone: $scope.user.phone }),
10+
// password: CryptoJS.MD5($scope.user.password).toString() }),
1111
headers: {
12-
'Content-Type': 'application/x-www-form-urlencoded'
12+
'Content-Type': 'application/json'
1313
}
1414
}).then(function successCallback(response) {
1515
$scope.hasError = false;
1616
tokenService.saveToken(response.data.access_token, response.data.userName);
17-
window.location.replace("/Home");
17+
window.location.replace("/Login");
1818
}, function errorCallback(response) {
1919
$scope.hasError = true;
2020
tokenService.deleteToken();

Diff for: Zenergy/Zenergy/Views/Register/index.cshtml

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
<div class="container " ng-controller="loginPageController">
88
<div class="row">
99
<div class="col-md-3 col-lg-offset-4">
10-
<h1>Sign in</h1>
11-
<form ng-submit="signIn()">
10+
<h1>Register</h1>
11+
<form ng-submit="register()">
1212

1313
<div class="form-group" ng-class="{ 'has-error': hasError}">
14-
<input type="email" class="form-control" ng-model="user.mail" placeholder="Email">
14+
<input type="email" class="form-control" ng-model="user.mail" placeholder="Email" required>
1515
</div>
1616

1717
<div class="form-group" ng-class="{ 'has-error': hasError}">
18-
<input type="password" class="form-control" ng-model="user.password" placeholder="Password">
18+
<input type="password" class="form-control" ng-model="user.password" placeholder="Password" required>
1919
</div>
2020

2121
<div class="form-group" ng-class="{ 'has-error': hasError}">
22-
<input type="password" class="form-control" ng-model="user.passwordBis" placeholder="Password Confirmation">
22+
<input type="password" class="form-control" ng-model="user.passwordBis" placeholder="Password Confirmation" required>
2323
</div>
2424

2525
<div class="form-group">
@@ -51,6 +51,7 @@
5151
</div>
5252

5353
<p class="text-danger" ng-if="hasError">Invalid email or password</p>
54+
5455
<input type="submit" id="submit" value="Sign in" class="btn btn-primary" />
5556
</form>
5657
</div>

Diff for: Zenergy/Zenergy/Web.config

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
</configSections>
1111
<connectionStrings>
1212
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-Zenergy-20151109023115.mdf;Initial Catalog=aspnet-Zenergy-20151109023115;Integrated Security=True" providerName="System.Data.SqlClient" />
13-
<add name="ZenergyContext" connectionString="metadata=res://*/Models.ZenergyModel.csdl|res://*/Models.ZenergyModel.ssdl|res://*/Models.ZenergyModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=zenergy.cb9xv2w6phgt.us-west-2.rds.amazonaws.com;initial catalog=zenergy;persist security info=True;user id=admin;password=zenergy1;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
14-
<!--<add name="ZenergyContext" connectionString="metadata=res://*/Models.ZenergyModel.csdl|res://*/Models.ZenergyModel.ssdl|res://*/Models.ZenergyModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=zenergy.cb9xv2w6phgt.us-west-2.rds.amazonaws.com;initial catalog=zenergyTest;persist security info=True;user id=admin;password=zenergy1;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />-->
13+
<!-- prod-->
14+
<!-- <add name="ZenergyContext" connectionString="metadata=res://*/Models.ZenergyModel.csdl|res://*/Models.ZenergyModel.ssdl|res://*/Models.ZenergyModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=zenergy.cb9xv2w6phgt.us-west-2.rds.amazonaws.com;initial catalog=zenergy;persist security info=True;user id=admin;password=zenergy1;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> -->
15+
16+
<!-- test-->
17+
<add name="ZenergyContext" connectionString="metadata=res://*/Models.ZenergyModel.csdl|res://*/Models.ZenergyModel.ssdl|res://*/Models.ZenergyModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=zenergy.cb9xv2w6phgt.us-west-2.rds.amazonaws.com;initial catalog=zenergyTest;persist security info=True;user id=admin;password=zenergy1;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
18+
1519
</connectionStrings>
1620
<appSettings></appSettings>
1721
<system.web>

0 commit comments

Comments
 (0)