null passwords for new users
This commit is contained in:
parent
bd4ad2b16e
commit
908238244f
|
@ -158,7 +158,7 @@ public static class SessionMethods
|
||||||
&& newUser
|
&& newUser
|
||||||
.WithParent(sessionUser)
|
.WithParent(sessionUser)
|
||||||
.Do(() => newUser.MustResetPassword = true)
|
.Do(() => newUser.MustResetPassword = true)
|
||||||
.Do(() => newUser.Password = newUser.SaltAndHashPassword(newUser.Password))
|
.Do(() => newUser.Password = null)
|
||||||
.Apply(Db.Create);
|
.Apply(Db.Create);
|
||||||
// && Mailer.Mailer.SendVerificationMessage(newUser);
|
// && Mailer.Mailer.SendVerificationMessage(newUser);
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public static class UserMethods
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String SaltAndHashPassword(this User user, String password)
|
public static String? SaltAndHashPassword(this User user, String password)
|
||||||
{
|
{
|
||||||
var dataToHash = $"{password}{user.Salt()}";
|
var dataToHash = $"{password}{user.Salt()}";
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class User : TreeNode
|
||||||
public Boolean HasWriteAccess { get; set; } = false;
|
public Boolean HasWriteAccess { get; set; } = false;
|
||||||
public Boolean MustResetPassword { get; set; } = false;
|
public Boolean MustResetPassword { get; set; } = false;
|
||||||
public String Language { get; set; } = null!;
|
public String Language { get; set; } = null!;
|
||||||
public String Password { get; set; } = null!;
|
public String? Password { get; set; } = null!;
|
||||||
|
|
||||||
[Unique]
|
[Unique]
|
||||||
public override String Name { get; set; } = null!;
|
public override String Name { get; set; } = null!;
|
||||||
|
|
|
@ -33,7 +33,7 @@ public static class Program
|
||||||
|
|
||||||
var startTime = Int64.Parse(args.ElementAtOr(1, (now - UnixTimeSpan.FromSeconds(20)).ToString()));
|
var startTime = Int64.Parse(args.ElementAtOr(1, (now - UnixTimeSpan.FromSeconds(20)).ToString()));
|
||||||
var endTime = Int64.Parse(args.ElementAtOr(2, now.ToString()));
|
var endTime = Int64.Parse(args.ElementAtOr(2, now.ToString()));
|
||||||
var nDataPoints = Int64.Parse(args.ElementAtOr(3, "11")) - 1 ;
|
var nDataPoints = Int64.Parse(args.ElementAtOr(3, "10"));
|
||||||
|
|
||||||
var timestampList = GetDataTimestamps(startTime, endTime, nDataPoints);
|
var timestampList = GetDataTimestamps(startTime, endTime, nDataPoints);
|
||||||
|
|
||||||
|
@ -47,17 +47,17 @@ public static class Program
|
||||||
{
|
{
|
||||||
// Calculating temporal distance of data files from the number of requested points. (rounding for int division)
|
// Calculating temporal distance of data files from the number of requested points. (rounding for int division)
|
||||||
var timeSpan = endTime - startTime;
|
var timeSpan = endTime - startTime;
|
||||||
var timeBetweenDataPoints1 = (timeSpan + nDataPoints -1) / nDataPoints;
|
var timeBetweenDataPoints = (Double)(timeSpan / nDataPoints);
|
||||||
|
timeBetweenDataPoints = Math.Max(2, timeBetweenDataPoints);
|
||||||
// We only upload data every second second so sampling more is impossible.
|
// We only upload data every second second so sampling more is impossible.
|
||||||
// If this ever changes we might have to change this as well.
|
// If this ever changes we might have to change this as well.
|
||||||
var timeBetweenDataPoints = Math.Max(timeBetweenDataPoints1, 2);
|
|
||||||
|
|
||||||
// Building a List of the timestamps we want to grab the files for.
|
// Building a List of the timestamps we want to grab the files for.
|
||||||
for (var i = startTime; i <= endTime; i += timeBetweenDataPoints)
|
for (Double i = startTime; i <= endTime; i += timeBetweenDataPoints)
|
||||||
{
|
{
|
||||||
//Rounding to even numbers only (we only save every second second)
|
//Rounding to even numbers only (we only save every second second)
|
||||||
yield return i%2 != 0 ? i+1 : i;
|
var integer = (Int64) Math.Round(i);
|
||||||
|
yield return integer/2 * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue