Skip to content

Commit

Permalink
fix: use otp as unique id for registering client through apkam
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierChanth committed Oct 4, 2024
1 parent 646048b commit 8b269dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ public static AtsignStatus Status(string atsign)
public static bool Enroll(string otp)
{
string devName = _controller.DeviceName;
if (devName == null || devName.Length == 0) devName = "client";
var args =
$"enroll -a \"{_controller.DeviceAtsign}\" -s {otp} -p {AppName} -d {_controller.DeviceName} -n \"{Namespaces[0]}\" -k {Path.Combine(_controller.AtsignKeysDirectory, _controller.DeviceAtsign + "_key.atKeys")}";
$"enroll -a \"{_controller.DeviceAtsign}\" -s \"{otp}\" -p \"{AppName}\" -d \"{devName}\" -n \"sshnp:rw,sshrvd:rw\" -k \"{Path.Combine(_controller.AtsignKeysDirectory, _controller.DeviceAtsign + "_key.atKeys")}\"";
string response = "";
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ private async void Generate_Click(object sender, RoutedEventArgs e)
EnrollResponse.Content = "";
string otp = $"{OtpBox1.Text}{OtpBox2.Text}{OtpBox3.Text}{OtpBox4.Text}{OtpBox5.Text}{OtpBox6.Text}".ToUpper();

_controller.DeviceName = _controller.NormalizeDeviceName($"client_{otp}");
Loading.Visibility = Visibility.Visible;
bool value = await Task.Run(() => ActivateController.Enroll(otp));
if (value)
Loading.Visibility = Visibility.Hidden;
if (value)
{
_controller.NextPage();
}
Expand Down

0 comments on commit 8b269dc

Please sign in to comment.