Commit 1ba34442 authored by Nicolas Jager's avatar Nicolas Jager

fix : wizzard create account with good credentials

Change-Id: Ie64dd640cea11876575e3e9fad4d0e4f88973818
Tuleap: #1283
parent e46fd0d9
......@@ -354,6 +354,13 @@ void RingClientUWP::RingD::deleteAccount(String ^ accountId)
tasksList_.push(task);
}
void RingClientUWP::RingD::registerThisDevice(String ^ pin, String ^ archivePassword)
{
tasksList_.push(ref new RingD::Task(Request::RegisterDevice, pin, archivePassword));
archivePassword = "";
pin = "";
}
void
RingClientUWP::RingD::startDaemon()
{
......@@ -649,13 +656,8 @@ RingClientUWP::RingD::startDaemon()
else {
switch (_startingStatus) {
case StartingStatus::REGISTERING_ON_THIS_PC:
{
tasksList_.push(ref new RingD::Task(Request::AddRingAccount));
break;
}
case StartingStatus::REGISTERING_THIS_DEVICE:
{
tasksList_.push(ref new RingD::Task(Request::RegisterDevice, _pin, _password));
break;
}
case StartingStatus::NORMAL:
......@@ -771,8 +773,8 @@ RingD::dequeueTasks()
break;
case Request::RegisterDevice:
{
auto pin = Utils::toString(_pin);
auto password = Utils::toString(_password);
auto pin = Utils::toString(task->_pin);
auto password = Utils::toString(task->_password);
std::map<std::string, std::string> deviceDetails;
deviceDetails.insert(std::make_pair(DRing::Account::ConfProperties::TYPE, "RING"));
......
......@@ -61,8 +61,6 @@ public:
}
}
property StartingStatus _startingStatus;
property String^ _pin; // you should RM ME
property String^ _password; // refatco : think a little... RM ME
void cancelOutGoingCall2(String^ callId); // marche
......@@ -100,10 +98,9 @@ internal:
void eraseCacheFolder();
void updateAccount(String^ accountId);
void deleteAccount(String^ accountId);
void registerThisDevice(String^ pin, String^ archivePassword);
/* TODO : move members */
///bool hasConfig; // replaced by startingStatus
std::string accountName; // YOU SHOULD RM ME
String ^ currentCallId; // to save ongoing call id during visibility change
/* events */
......
......@@ -54,9 +54,13 @@
<TextBox x:Name="_aliasTextBox_"
Margin="10"
PlaceholderText="Enter your username"/>
<PasswordBox Margin="10"
<PasswordBox x:Name="_password_"
Margin="10"
PasswordChanged="validatePassword"
PlaceholderText="Enter your password"/>
<PasswordBox Margin="10,10,10,20"
<PasswordBox x:Name="_passwordCheck_"
Margin="10,10,10,20"
PasswordChanged="validatePassword"
PlaceholderText="Repeat your Password"/>
</StackPanel>
<!-- SIP account. -->
......@@ -81,6 +85,7 @@
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xE081;"
IsEnabled="False"
Click="_createAccountYes__Click"
Style="{StaticResource ButtonStyle2}"/>
</StackPanel>
......
......@@ -32,14 +32,12 @@ void
Wizard::_createAccountYes__Click(Object^ sender, RoutedEventArgs^ e)
{
auto alias = _aliasTextBox_->Text;
if (alias->IsEmpty())
alias = "windows user";
std::wstring wstr(alias->Begin());
std::string str(wstr.begin(), wstr.end());
RingD::instance->_startingStatus = StartingStatus::REGISTERING_ON_THIS_PC;
RingD::instance->accountName = std::string(wstr.begin(), wstr.end());
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([this] () {
this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(RingClientUWP::MainPage::typeid));
RingD::instance->createRINGAccount(_aliasTextBox_->Text, _password_->Password, true);
_password_->Password = "";
}));
}
......@@ -118,11 +116,21 @@ Wizard::_avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xa
void RingClientUWP::Views::Wizard::_addAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
RingD::instance->_pin = _PINTextBox_->Text;
RingD::instance->_password = _ArchivePassword_->Password;
RingD::instance->_startingStatus = StartingStatus::REGISTERING_THIS_DEVICE;
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this]() {
this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(RingClientUWP::MainPage::typeid));
RingD::instance->registerThisDevice(_PINTextBox_->Text, _ArchivePassword_->Password);
_ArchivePassword_->Password = "";
_PINTextBox_->Text = "";
}));
}
void RingClientUWP::Views::Wizard::validatePassword(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_createAccountYes_->IsEnabled = (_password_->Password
== _passwordCheck_->Password
&& _password_->Password->Length() > 0)
? true : false;
}
......@@ -17,6 +17,7 @@ private:
void _showAddAccountMenuBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _addAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void validatePassword(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment